#ifndef __M_UTILS_STRING_H__
#define __M_UTILS_STRING_H__

#include "list/linked_list.h"

#define IS_ENGLISH_CHARACTER(ch) ((ch >= 0x41 && ch <= 0x5A) || (ch >= 0x61 && ch <= 0x7A))

char *strnchr(const char *str, size_t n, int c);
void StringTrim(char *str);

int StringToDecimal(const char *str);
unsigned int StringToHexdecimal(const char *str);
int StringToBoolean(const char *str);

int StringGetLine(const char *buffer, int size, char **line);
int StringParseLine(const char *line, char **section, char **key, char **value);

char *StringMakeShortByWidth(const char *str, int limit_w);
char *StringBreakLineByWidth(const char *str, int limit_w);

int StringToListByWidthFromBuffer(LinkedList *list, char *buffer, size_t size, int limit_w);
int StringToListByWidth(LinkedList *list, const char *str, int limit_w);

#endif
